<ui:composition template="/WEB-INF/templates/showcase.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:o="http://omnifaces.org/ui"
	xmlns:of="http://omnifaces.org/functions"
>
	<ui:define name="description">
		<p>
			Collection of EL functions for array manipulation: <code>of:createArray()</code>, <code>of:createIntegerArray()</code>,  
			and <code>of:contains()</code>.
		</p>
		<ui:include src="/WEB-INF/includes/utils/feature-request.xhtml" />
	</ui:define>		
	
	<ui:define name="demo">
		<p>
			Create a dummy array of size 5:
			<ui:repeat value="#{of:createArray(5)}" varStatus="loop">
				#{loop.index}#{!loop.last ? ', ' : ''}
			</ui:repeat>
		</p>

		<p>
			Create an integer array from 10 to 20:
			<ui:repeat value="#{of:createIntegerArray(10, 20)}" var="i" varStatus="loop">
				#{i}#{!loop.last ? ', ' : ''}
			</ui:repeat>
		</p>

		<h:form>
			<p>
				Create an integer array for <code>&lt;f:selectItems&gt;</code>:
				<h:selectOneMenu value="#{functionsBean.day}">
					<f:selectItems value="#{of:createIntegerArray(1, 31)}" />
					<f:ajax render="day" />
				</h:selectOneMenu>

				<c:set var="year" value="#{of:formatDate(now, 'yyyy')}" />
				<h:selectOneMenu value="#{functionsBean.year}">
					<f:selectItems value="#{of:createIntegerArray(year, year - 10)}" />
					<f:ajax render="year" />
				</h:selectOneMenu>

				chosen: <strong><h:outputText id="day" value="#{functionsBean.day}" /></strong>
				and <strong><h:outputText id="year" value="#{functionsBean.year}" /></strong>
			</p>
		</h:form>

		<p>
			Check if an array contains the specified value: 
			<a href="?test=7&amp;test=42&amp;test=69">clicking here should print true</a>:
			<strong>#{of:contains(paramValues.test, 42)}</strong>
		</p>
	</ui:define>
</ui:composition>